import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { EliteLayoutSettingComponent } from "./layout.setting.component";
import { LAYOUT_SERVICE } from "../inerface/layout-service.interface";
import { LayoutService } from "../service/layout-service";
import { DxDataGridModule, DxSelectBoxModule, DxButtonModule,DxPopupModule } from "devextreme-angular";
import { FormsModule, ReactiveFormsModule } from "@angular/forms";
import { TranslateModule, TranslateService } from "ng2-translate";
import { LanType, ConstantsConvert, ILanEnumPair } from "wit-core";

@NgModule({
    declarations: [
        EliteLayoutSettingComponent
    ],
    imports: [
        CommonModule,
        DxSelectBoxModule,
        DxButtonModule,
        TranslateModule,
        ReactiveFormsModule,
        FormsModule,
        DxPopupModule
    ],
    exports: [EliteLayoutSettingComponent],
    providers: [{
        provide: LAYOUT_SERVICE,
        useClass: LayoutService
    }],
})
export class EliteLayoutSettingModule {
    constructor(translate: TranslateService) {
        ConstantsConvert.lans.forEach((l:ILanEnumPair) => {
            let lan = ConstantsConvert.GetByLanEnum(l.key);
            translate.setTranslation(
                lan,
                require(`../../assets/i18n/${lan}.json`),
                true);
        });
    }
}